package com.qq.spirit.inter;

import java.util.List;

import org.apache.http.Header;
import org.apache.http.NameValuePair;

import com.qq.spirit.GameUtil;
import com.qq.spirit.LoggerUtil;
import com.qq.spirit.LoginTask;
import com.qq.spirit.TaskManager;
import com.qq.spirit.GameUserInfoUtil;
import com.qq.spirit.model.XmlDataUtil;
import com.qq.spirit.model.XmlNodeData;

public abstract class AbstractHtmlActionAfterRequest implements IActionAfterHttpRequest
{

	public int gid;
	public TaskUnit taskUnit;

	@Override
	public void call(String type, List<Header> headerList, String content)
	{
		try
		{
			doCall(headerList, content);
		} catch (Exception ex)
		{
			ex.printStackTrace();
		} finally
		{

		}
	}

	/**
	 * 记录错误消息
	 * 
	 * @param data
	 */
	private void logErrorInfo(XmlNodeData data)
	{
		String state = GameUtil.getResultState(data);
		String exception = GameUtil.getResultException(data);
		String message = GameUtil.getResultMessage(data);
		LoggerUtil.info(gid,GameUserInfoUtil.getGameName(gid) + taskUnit.getClass().getName() + " 返回码：" + state + ",消息值:" + message + ",异常码:" + exception);
	}

	public abstract void doCall(List<Header> headerList, String content);
}
